

YatunServer::YatunServer(ConfigParser *in) {
    Config = in;
}

YatunServer::~YatunServer() { 
    // znic tunely... 
}

YatunServer::SetConf(struct YatunServerConf &in) {
    UseMServer = in.UseMServer;
    mServerAddress = in.mServerAddress;
    mServerPort = in.mServerPort;

    localaddr.sin_family = AF_INET;
    localaddr.sin_port = htons (in.Port);
    localaddr.sin_addr.s_addr = INADDR_ANY;

    IOIncome = new IO_TCP (&localaddr);
    IOIncome->Open();
    
    if(UseMServer) {
//	mServerClient mServer;
	localaddr.sin_family = AF_INET;
        localaddr.sin_port = htons (mServerPort);
	localaddr.sin_addr.s_addr = inet_addr(mServerAddress);

        IOmServer = new IO_UDP (&localaddr);
	IOmServer->Open();
	
//	mServer = new mServerClient(IOmServer);
//	mServer->RegisterServer(ServerName);
    }
}

YatunServer::Run() {
    IOIncome->Listen();
    
    while (1) {
	
	usleep(10);
    }
    
}

c_Plug_IO* YatunServer::Negotiate(c_Plug_IO *) {
    

}

